<% dim ImageID dim Image ImageID = request.querystring("ID") if ImageID = "" then ImageID=6 end if set Connection = server.createobject("ADODB.Connection") Connection.Open "CalsurDB", "admin", "" set Result = server.createobject("ADODB.Recordset") sql = "SELECT file FROM tblData WHERE ID=" & ImageID Result.Open sql, Connection, adOpenKeyset if not (Result.eof and Result.bof) then Image = Result("file").GetChunk(1024000) Response.ContentType = "image/gif" Response.BinaryWrite Image else 'Response.Write "ID '" & ImageID & "' not found in DB." Response.Redirect("images.asp?ID=6") end if Result.Close Connection.Close Response.End %>